package com.example.sunmiv1.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.sunmiv1.R;
import com.example.sunmiv1.base.BaseActivity;
import com.example.sunmiv1.utils.net.ACache;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class CreditActivity extends BaseActivity {


    @BindView(R.id.title_back)
    ImageView titleBack;
    @BindView(R.id.title_title)
    TextView titleTitle;
    @BindView(R.id.creditIndex_order)
    LinearLayout creditIndexOrder;
    @BindView(R.id.creditIndex_user)
    LinearLayout creditIndexUser;

    private Intent intent;
    private Context context;
    private ACache aCache;

    @Override
    protected void initView() {
        setContentView(R.layout.activity_credit);
        ButterKnife.bind(this);
        context = this;
        aCache = ACache.get(context);
    }

    @Override
    protected void initData() {
        if ("1".equals(aCache.getAsString("userType"))) {
            creditIndexUser.setVisibility(View.INVISIBLE);
        }
    }

    @Override
    protected void initListener() {

    }

    @OnClick({R.id.title_back, R.id.creditIndex_order, R.id.creditIndex_user})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.title_back:
                finish();
                break;
            case R.id.creditIndex_order:
                intent = new Intent(context, CreditOrderActivity.class);
                startActivity(intent);
                break;
            case R.id.creditIndex_user:
                intent = new Intent(context, CreditUserActivity.class);
                startActivity(intent);
                break;
        }
    }
}
